home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #11 / Amiga Plus CD - 2004 - No. 11.iso / AmiSoft / Util / conv / Acvt.lha / Acvt 1.07 / sources / cdisk.h < prev    next >
C/C++ Source or Header  |  1999-06-10  |  2KB  |  96 lines

  1. //    This program is free software; you can redistribute it and/or modify
  2. //    it under the terms of the GNU General Public License as published by
  3. //    the Free Software Foundation; either version 2 of the License, or
  4. //    any later version.
  5. //
  6. //    This program is distributed in the hope that it will be useful,
  7. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  9. //    GNU General Public License for more details.
  10. //
  11. //    You should have received a copy of the GNU General Public License
  12. //    along with this program; if not, write to the Free Software
  13. //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  14. //
  15.  
  16. #ifndef __CDISK_H__
  17. #define __CDISK_H__
  18.  
  19. #include "wintypes.h"
  20. #include "cobj.h"
  21.  
  22. #define CDISK_ERROR_CANT_OPEN ( CDISK_BASE + 0 )
  23.  
  24. typedef enum
  25. {
  26.     DISK_AUTO,
  27.     DISK_ATR,
  28.     DISK_ATRb,
  29.     DISK_XFD,
  30.     DISK_XFDb,
  31.     DISK_SCP,
  32.     DISK_DCM
  33. } DISK_TYPE;
  34.  
  35. typedef enum
  36. {
  37.     DI_RET_OK,
  38.     DI_RET_CANT_CONTINUE,
  39.     DI_RET_CONTINUE
  40. } DISKINIT_RETCODE;
  41.  
  42. typedef struct
  43. {
  44.     int iSides;
  45.     int iTracks;
  46.     int iSectorsPerTrack;
  47.     int iBytesPerSector;
  48.     int iSectors;
  49. } DISK_GEOMETRY;
  50.  
  51. class CDisk : public CObj
  52. {
  53. public:
  54.     CDisk();
  55.     virtual ~CDisk();
  56.  
  57.     virtual BOOL Load( char*, BOOL = FALSE, BOOL = FALSE ) = 0;
  58.  
  59.     #ifdef __CDISK_WRITE__
  60.     virtual BOOL Save( char*, BOOL ) = 0;
  61.     #endif
  62.  
  63.     BOOL Format( DISK_GEOMETRY* );
  64.     
  65.     DISK_GEOMETRY* GetGeometry() { return &m_geometry; };
  66.     int GetSectorSize() { return m_geometry.iBytesPerSector; };
  67.     int GetSectorCount() { return m_geometry.iSectors; };
  68.  
  69.     BOOL ReadSector( void*, int );
  70.     BOOL WriteSector( int, void* );
  71.  
  72.     BOOL ReadSectors( void*, int, int );
  73.     BOOL WriteSectors( int, void*, int );
  74.  
  75.     BOOL Duplicate( CDisk* );
  76.  
  77.     char* GetImageName() { return m_szFname; };
  78.  
  79. protected:
  80.     DISK_GEOMETRY m_geometry;
  81.     BOOL m_bOpened;
  82.     BYTE *m_pbtMemory;
  83.     int m_iAllocated;
  84.  
  85.     char m_szFname[ 255 ];
  86. };
  87.  
  88. void GuessClassicSizes( int, int, DISK_GEOMETRY* );
  89.  
  90. char* GetDiskTypeName( DISK_TYPE disktype );
  91. char* GetDiskTypeExt( DISK_TYPE disktype );
  92.  
  93. DISKINIT_RETCODE InitializeDisk( CDisk**, DISK_TYPE, char*, BOOL bVerbose, BOOL, BOOL );
  94.  
  95. #endif
  96.